<template>
	<view class="item" @click="onClickItem()">
		<view class="left">
			<image class="icon" src="https://snpl.scgjcx.com/static/device.png"></image>
			<view class="name">{{ device.name }}</view>
			<view class="addr">
				<text>No.{{ device.no }} </text>
				<text class="ws">{{ device.workingStatus ? '|工作中' : '|已停止' }}</text>
			</view>
		</view>
		<view class="right">
			<image v-if="device.online" class="icon" src="https://snpl.scgjcx.com/static/online.png"></image>
			<image v-else class="icon" src="https://snpl.scgjcx.com/static/offline.png"></image>
		</view>
	</view>
</template>

<script>
	export default {
		name:"item",
		props: {
			device: {
				type: Object,
				default: function () {
					return {};
				}
			}
			
		},
		methods: {
			onClickItem() {
				uni.navigateTo({
					
					url: `/pages/channel/index?name=${this.device.name}&device=${this.device.id}&no=${this.device.no}&station=${this.device.station}&online=${this.device.online}`
				});
			}
		},
		
	}
</script>

<style lang="less" scoped>
	.item {
		background-color: #fff;
		border-radius: 5px;
		box-sizing: border-box;
		padding: 15px 25px 20px;
		margin-bottom: 10px;
		display: flex;
		justify-content: space-between;
		box-shadow: 0 0 2px 2px rgba(153,153, 153, 0.2);
		
		.left {
			.icon {
				width: 40px;
				height: 40px;
			}
			
			.name {
				color: rgb(130, 129, 134);
				font-size: 16px;
			}
			
			.addr {
				color: rgb(176, 176, 176);
				font-size: 12px;
				display: flex;
				justify-content: space-between;
				.ws {
					margin-left: 10px;
					color: #EEB61B;
				}
			}
		}
		
		.right {
			width: 40px;
			text-align: right;
			color: rgb(186, 186, 186);
			font-size: 14px;
			
			.icon {
				width: 26px;
				height: 26px;
			}
		}

	}
</style>